package com.android.fluttercontainer;

import android.content.Context;
import android.content.Intent;

import io.flutter.app.FlutterApplication;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.loader.FlutterApplicationInfo;
import io.flutter.plugin.common.MethodChannel;

/**
 * 创建者 ：  huyangyang962
 * 创建日期： 2021/5/21 3:54 PM
 * 描述：
 */
public class FlutterUtils {
    public static Intent getFultterIntent(Context context) {
        return FlutterActivity
                .withCachedEngine("my_engine_id")
                .build(context)
                .setClass(context, MyFlutterActivity.class)
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    }
    public static Intent getNewFultterIntent(Context context) {

        return FlutterActivity
                .withNewEngine()
                .build(context)
                .setClass(context, MyFlutterActivity.class)
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
    }
}
